<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>放款录单台账列表</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">领取人</div>
                    <div class="field">
                        <input name="crtRlNm" id="crtRlNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">承租人</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">领取日期</div>
                    <div class="field">
                        <input name="crtStartDt" id="crtStartDt" type="text" class="ui-datepicker" value="">
                        -
                        <input name="crtEndDt" id="crtEndDt" type="text" class="ui-datepicker" value="">
                    </div>
                </div>
                <div class="fieldBox">
                    <div class="label">流程编号</div>
                    <div class="field">
                        <input name="pNo" id="pNo" type="text" class="ui-textbox" value="">
                    </div>
                </div>
                <div class="fieldBox col_33" id="isSplMfrDiv" >
                    <div class="label">是否厂商业务</div>
                    <div class="field">
                        <select name="isSplMfr"  id="isSplMfr"  >
                            <option value="  "  selected="selected">--请选择--</option>
                            <option value="0" >否</option>
                            <option value="1">是</option>
                        </select>
                    </div>
                </div>
                <div class="fieldBox col_33" id="isInsBizDiv" >
                    <div class="label">是否资管业务</div>
                    <div class="field">
                        <select name="isInsBiz"  id="isInsBiz"  >
                            <option value=" "  selected="selected">--请选择--</option>
                            <option value="0">否</option>
                            <option value="1">是</option>
                        </select>
                    </div>
                </div>
                <div class="fieldBox" id="searchPrjTypCd">
                    <div class="label">项目类型</div>
                    <div class="field">
                        <select name="prjTypCd"  id="prjTypCd" >
                            <option value="  " selected="selected">--请选择--</option>
                            <c:forEach items="${projectTypeList}" var="opt">
                                <option value="${opt.key}">${opt.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="fieldBox" id="searchPayStsCd">
                    <div class="label">放款状态</div>
                    <div class="field">
                        <select name="payStsCd"  id="payStsCd" >
                            <option value="  " selected="selected">--请选择--</option>
                            <c:forEach items="${payStsCdList}" var="opt">
                                <option value="${opt.key}">${opt.value}</option>
                            </c:forEach>
                        </select>
                    </div>
                </div>
                <div class="clearFix"></div>
                <div class="btnsBox formBtns notRight">
                    <span id="searchBtn" class="sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button-round">清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div class="sqPanel" style="margin-bottom: 0;">
        <div class="sqPanel_head" style="float:left;color: red">
            <table class="table_full">
                <tr>
                    <td>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><i class="ico_flasher"></i></b>仅支持近一年内的数据查询
                    </td>
                </tr>
            </table>
        </div>
        <div id="ligergrid1" class="sq-grid"></div>
    </div>
</div>

<script type="text/javascript">
    var grid = null;
    var _bookTypCd = "7";
    $(function () {
        //初始化列表
        initGrid();
        grid = liger.get("ligergrid1");
        grid.setHeight(100);
        $("#searchBar").ligerForm();
        //查询
        $("#searchBtn").click(function(event) {
            var form = liger.get("searchBar");
            var data = form.getData();
            for (name in data){
                grid.setParm(name,data[name]);
            };
            if($("#crtEndDt").val() != "" && $("#crtStartDt").val()>$("#crtEndDt").val()){
                $.ligerDialog.SQalert({content: "领取日期(起)不能大于领取日期(止)" , SQ_type: "warning" });
                return;
            }
            var date1 = new Date();
            date1.setFullYear(date1.getFullYear()-1);
            date1.setDate(date1.getDate() + 1);
            if (StringUtils.isEmpty($("#cstNm").val()) && StringUtils.isEmpty($("#pNo").val())) {
                if (StringUtils.isEmpty($("#crtStartDt").val())){
                    grid.setParm("crtStartDt",DateUtils.formatDate(date1,DateUtils.YYYY_MM_DD));
                }
                var flag = false;
                if (StringUtils.isNotEmpty($("#crtStartDt").val()) && $("#crtStartDt").val() < DateUtils.formatDate(date1,DateUtils.YYYY_MM_DD)){
                    flag = true;
                }
                if (StringUtils.isNotEmpty($("#crtEndDt").val()) && $("#crtEndDt").val() < DateUtils.formatDate(date1,DateUtils.YYYY_MM_DD)){
                    flag = true;
                }
                if (flag){
                    top.$.ligerDialog.SQalert({content: "仅可查询领取日期至今一年内数据",SQ_type: "success"});
                    grid.setParm("crtStartDt",DateUtils.formatDate(date1,DateUtils.YYYY_MM_DD));
                }
            }
            grid.reload();
        });
        //清空
        $("#clearBtn").click(function(event) {
            $("#resetBtn").click();  //重置 input-text
            var form = liger.get("searchBar");
        });
        $("#pageloading").hide();
    });

    //初始化列表
    function initGrid() {
        $("#ligergrid1").ligerGrid({
            url: '<%=path%>/audit/audStandingBook/initRecordBookList.do',
            method : 'get',
            parms: {bookTypCd: _bookTypCd},
            columns: [
                { display: '台账编码', name: 'bookCode', width: 130},
                { display: '领取时间', name: 'receiveTm', width: 140,align: 'center', enabledSort: false, render: renderDateDetail},
                { display: '领取人', name: 'crtUsrNm', width: 100},
                { display: '流程编号', name: 'capPNo', width: 150},
                { display: '承租人', name: 'prjBscInfoVO.cstNm', width: 100},
                { display: '客户经理', name: 'prjBscInfoVO.cstMgrNm', width: 100},
                { display: '客户经理所属机构', name: 'prjBscInfoVO.buOrgCdNm', width: 100},
                { display: '省公司', name: 'prjBscInfoVO.prOrgCdNm', width: 100 , enabledSort:true},
                { display: '分公司', name: 'prjBscInfoVO.cyOrgCdNm', width: 100 , enabledSort:true},
                { display: '项目类型', name: 'prjBscInfoVO.prjTypCdNm', width: 100},
                { display: '是否厂商业务', name: '', minWidth: 100 , enabledSort:true,
                    render: function (rowdata, rowindex, value, column) {
                        if (rowdata.prjBscInfoVO.isSplMfr == 1) {
                            return "是";
                        } else if (rowdata.prjBscInfoVO.isSplMfr == 0) {
                            return "否";
                        }
                    }
                },
                { display: '是否资管业务', name: '', minWidth: 100 , enabledSort:true,
                    render: function (rowdata, rowindex, value, column) {
                        if (rowdata.prjBscInfoVO.isInsBiz == 1) {
                            return "是";
                        } else if (rowdata.prjBscInfoVO.isInsBiz == 0) {
                            return "否";
                        }
                    }
                },
                { display: '放款状态', name: 'capPayInfoVO.payStsCdNm', width: 100, align: 'center', enabledSort: false},
                { display: '实际放款金额', name: 'capPayInfoVO.actPayAmt', width: 100, align: 'right', enabledSort: false,
                    render:function(rowdata,index,value){
                        if(rowdata.capPayInfoVO.actPayAmt){
                            return '&yen;'+FormatMoney(rowdata.capPayInfoVO.actPayAmt/100);
                        }
                    }
                },
                { display: '实际放款时间', name: 'capPayInfoVO.actPayTm', width: 100, align: 'center', enabledSort: false,render:renderDateDetail}
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '95%',
            heightDiff: -2,
            checkbox: true,
            rownumbers: true,
            onAfterShowData: function () {
                $(".gridTip").grid_ligerTip();
                SetIframe_height();
            }
        })
    }
    function iframeResize () {
        if (parent.mainApp) {
            parent.mainApp.parentTab.onResize();
        }
    }
    //格式化时间
    function renderDateDetail(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
        }
        return dateStr;
    }
</script>
</body>
</html>